home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Comm / term-source.lha / Extras / Source / gtlayout-Source.lha / LTP_DrawTapeButton.c < prev    next >
C/C++ Source or Header  |  1995-03-25  |  2KB  |  107 lines

  1. /*  GadTools layout toolkit
  2. **
  3. **  Copyright © 1993-1995 by Olaf `Olsen' Barthel
  4. **  Freely distributable.
  5. */
  6.  
  7. #include "gtlayout_global.h"
  8.  
  9. #ifdef DO_TAPEDECK_KIND
  10. VOID __regargs
  11. LTP_DrawTapeButton(struct RastPort *RPort,ImageInfo *imageInfo,LONG Left,LONG Top,LONG Width,LONG Height,LONG AspectX,LONG AspectY,LONG Background)
  12. {
  13.     LONG        SizeX,SizeY,Mid,Size;
  14.     ImageTypes    ImageType;
  15.  
  16.     ImageType    = imageInfo -> ImageType;
  17.     SizeX        = imageInfo -> GlyphWidth;
  18.     SizeY        = imageInfo -> GlyphHeight;
  19.  
  20.     Left    += 6;
  21.     Top    += 3;
  22.  
  23.     Width    -= 2 * 6;
  24.     Height    -= 2 * 3;
  25.  
  26.     if(!SizeY)
  27.         SizeY = Height;
  28.  
  29.     if(!SizeX)
  30.     {
  31.         SizeX = (SizeY * AspectY) / AspectX;
  32.  
  33.         if(ImageType == IMAGECLASS_BACKWARD || ImageType == IMAGECLASS_FORWARD)
  34.             SizeX *= 2;
  35.     }
  36.  
  37.     if(SizeX > 0 && SizeY > 0)
  38.     {
  39.         switch(ImageType)
  40.         {
  41.             case IMAGECLASS_BACKWARD:
  42.             case IMAGECLASS_FORWARD:
  43.  
  44.                 Left    = Left + (Width - SizeX) / 2;
  45.                 Top    = Top + (Height - SizeY) / 2;
  46.  
  47.                 LTP_DrawBackFore(RPort,ImageType == IMAGECLASS_BACKWARD,Left,Top,SizeX,SizeY);
  48.                 break;
  49.  
  50.             case IMAGECLASS_PREVIOUS:
  51.             case IMAGECLASS_NEXT:
  52.  
  53.                 Left    = Left + (Width - SizeX) / 2;
  54.                 Top    = Top + (Height - SizeY) / 2;
  55.  
  56.                 LTP_DrawPrevNext(RPort,ImageType == IMAGECLASS_PREVIOUS,Left,Top,SizeX,SizeY);
  57.                 break;
  58.  
  59.             case IMAGECLASS_EJECT:
  60.  
  61.                 Left    = Left + (Width - SizeX) / 2;
  62.                 Top    = Top + (Height - SizeY) / 2;
  63.  
  64.                 LTP_DrawPicker(RPort,TRUE,Left,Top,SizeX,SizeY);
  65.                 break;
  66.  
  67.             case IMAGECLASS_RECORD:
  68.  
  69.                 LTP_RenderCircle(RPort,Left + Width / 2,Top + Height / 2,SizeY / 2,AspectX,AspectY);
  70.                 break;
  71.  
  72.             case IMAGECLASS_PLAY:
  73.             case IMAGECLASS_REWIND:
  74.  
  75.                 Left    = Left + (Width - SizeX) / 2;
  76.                 Top    = Top + (Height - SizeY) / 2;
  77.  
  78.                 LTP_RenderArrow(RPort,ImageType == IMAGECLASS_REWIND,Left,Top,SizeX,SizeY);
  79.                 break;
  80.  
  81.             case IMAGECLASS_STOP:
  82.  
  83.                 Left    = Left + (Width - SizeX) / 2;
  84.                 Top    = Top + (Height - SizeY) / 2;
  85.  
  86.                 RectFill(RPort,Left,Top,Left + SizeX - 1,Top + SizeY - 1);
  87.                 break;
  88.  
  89.             case IMAGECLASS_PAUSE:
  90.  
  91.                 Left    = Left + (Width - SizeX) / 2;
  92.                 Top    = Top + (Height - SizeY) / 2;
  93.  
  94.                 RectFill(RPort,Left,Top,Left + SizeX - 1,Top + SizeY - 1);
  95.  
  96.                 Size    = SizeX - (2 * SizeX) / 3;
  97.                 Mid    = SizeX / 3;
  98.  
  99.                 LTP_SetAPen(RPort,Background);
  100.                 RectFill(RPort,Left + Mid,Top,Left + Mid + Size - 1,Top + SizeY - 1);
  101.  
  102.                 break;
  103.         }
  104.     }
  105. }
  106. #endif    /* DO_TAPEDECK_KIND */
  107.